﻿Imports System.IO
Public Class DataAccess
    Public Sub ConnectDatabase_DBAccess(ByRef dbConn As OleDb.OleDbConnection)
        Dim CurrentDir As String = Path.GetDirectoryName(Application.ExecutablePath)
        Dim PathConfigFile As String = CurrentDir + "\PathConfig.txt"
        Dim DatabasePath As String = System.IO.File.ReadAllText(PathConfigFile)
        ''Access Connection String
        'dbConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabasePath & "\dbQuanLyNhaHang.mdb;Jet OLEDB:Database Password=!@#$%^&*(;"
        ''SQL Connection String
        'dbConn.ConnectionString = "Provider=SQLOLEDB;Data Source=NGOCTRAM-PC\SQLEXPRESS_DNN;Initial Catalog=QuanLyKhachHang;User Id=sa;Password=123;"
        Dim encrypt As New Common
        dbConn.ConnectionString = encrypt.Decrypt(DatabasePath)
        Try
            dbConn.Open()
        Catch ex As Exception
            ErrorConnectServer(ex)
        End Try
    End Sub
End Class
